package com.mrjy.maintain.bo;

import java.util.HashMap;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.dao.DataAccessException;
import org.springframework.stereotype.Service;

import com.mrjy.common.entity.SchoolTeam;
import com.mrjy.maintain.dao.ISchoolTeamDao;

@Service("schoolTeamBo")
public class SchoolTeamBo implements ISchoolTeamBo {
	@Resource
	private ISchoolTeamDao schoolTeamDao;

	@Override
	public Map<String, Object> schoolTeamList(SchoolTeam schoolTeame) {
		// TODO Auto-generated method stub
		Map<String, Object> map = new HashMap<String, Object>();
		//map.put("total", schoolTeamDao.countSchoolTeam());
		map.put("rows", schoolTeamDao.schoolTeamList(schoolTeame));
		return map;
	}
	
	@Override
	public Map<String, Object> schoolTeamByPage(SchoolTeam schoolTeame) {
		// TODO Auto-generated method stub
		Map<String, Object> map = new HashMap<String, Object>();
		//map.put("total", schoolTeamDao.countSchoolTeam());
		map.put("rows", schoolTeamDao.queryPageSchoolTeam(schoolTeame));
		return map;
	}

	@Override
	public int insert(SchoolTeam schoolTeam) {
		// TODO Auto-generated method stub
		return schoolTeamDao.insert(schoolTeam);
	}
	
	@Override
	public SchoolTeam queryById(int id) {
		// TODO Auto-generated method stub
		return schoolTeamDao.queryById(id);
	}
	@Override
	public int txUpdateById(SchoolTeam schoolTeam) {
		// TODO Auto-generated method stub
		return schoolTeamDao.updateById(schoolTeam);
	}
	@Override
	public int txDeleteByIds(int[] ids) {
		// TODO Auto-generated method stub
		try{
			return schoolTeamDao.deleteByIds(ids);
		}catch(DataAccessException  e){
			return 0;
		}
	}
}
